package thread;

import java.util.Scanner;

/**
 * sleep阻塞
 * 进入阻塞状态指定毫秒
 */
public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        System.out.print("请输入一个数字：");
        Scanner s = new Scanner(System.in);
        int n = Integer.parseInt(s.next());
        while (n>0){
            System.out.println("倒计时："+n);
            n--;
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("程序结束了");
    }
}
